package com.gdit.revenue.dao;

import com.gdit.revenue.model.Expenditure;
import com.gdit.revenue.model.User;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface ExpenditureDao {

    //分页查询Expenditure表数据
    @Select("select * from expenditure limit #{offset},#{limit}")  // 检索记录行 offset-limit   如：0-4 5-9
    List<Expenditure> getAllExpenditures(int offset, int limit);

    //统计Expenditure表总条数
    @Select("select count(*) from expenditure")
    int count();

    //删除expenditure表单单条数据
    @Delete("delete from expenditure where orderid=#{orderid}")
    int delete(int orderid);

    //向expenditure表新增数据
    @Insert("insert into expenditure (title,name,money,paymode,remarks,time) values(#{title},#{name},#{money},#{paymode},#{remarks},#{time})")
    int insert(Expenditure expenditure);

    //修改expenditure表数据
    @Update("update expenditure set title=#{title},name=#{name},money=#{money},paymode=#{paymode},remarks=#{remarks},time=#{time} where orderid=#{orderid}")
    int update(Expenditure expenditure);

}
